@import '@/styles/variables.less';
@import '@/styles/mixins.less';

.file-uploader {
  width: 100%;

  &__dropzone {
    border: 2px dashed @gray-300;
    border-radius: @border-radius-xl;
    padding: @spacing-2xl;
    text-align: center;
    cursor: pointer;
    transition: all @transition-normal;
    background: @gray-50;

    &:hover {
      border-color: @primary-400;
      background: @primary-50;
    }

    &--drag-over {
      border-color: @primary-600;
      background: @primary-100;
      transform: scale(1.02);
    }

    &--disabled {
      opacity: 0.5;
      cursor: not-allowed;

      &:hover {
        border-color: @gray-300;
        background: @gray-50;
      }
    }
  }

  &__dropzone-content {
    .flex-column();
    align-items: center;
    gap: @spacing-lg;
  }

  &__icon {
    color: @gray-400;
    transition: color @transition-normal;

    .file-uploader__dropzone:hover & {
      color: @primary-600;
    }
  }

  &__text {
    h3 {
      font-size: @font-size-lg;
      font-weight: 600;
      color: @gray-900;
      margin: 0 0 @spacing-sm 0;
    }

    p {
      color: @gray-600;
      margin: 0;
      line-height: 1.5;
    }
  }

  &__input {
    display: none;
  }

  &__files {
    margin-top: @spacing-lg;
  }

  &__files-header {
    .flex-between();
    align-items: center;
    margin-bottom: @spacing-md;
    padding-bottom: @spacing-sm;
    border-bottom: 1px solid @gray-200;

    h4 {
      font-size: @font-size-lg;
      font-weight: 600;
      color: @gray-900;
      margin: 0;
    }
  }

  &__files-info {
    font-size: @font-size-sm;
    color: @gray-600;
  }

  &__files-list {
    display: flex;
    flex-direction: column;
    gap: @spacing-sm;
  }

  &__file-item {
    .flex-start();
    gap: @spacing-md;
    padding: @spacing-md;
    border: 1px solid @gray-200;
    border-radius: @border-radius-lg;
    background: white;
    transition: all @transition-fast;

    &:hover {
      border-color: @gray-300;
      box-shadow: @shadow-sm;
    }

    &--error {
      border-color: @error-300;
      background: @error-50;
    }
  }

  &__file-preview {
    width: 60px;
    height: 40px;
    border-radius: @border-radius;
    overflow: hidden;
    flex-shrink: 0;
    background: @gray-100;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  &__file-icon {
    width: 100%;
    height: 100%;
    .flex-center();
    color: @gray-400;
  }

  &__file-info {
    flex: 1;
    min-width: 0;
  }

  &__file-name {
    font-weight: 500;
    color: @gray-900;
    .truncate();
    margin-bottom: 2px;
  }

  &__file-meta {
    font-size: @font-size-xs;
    color: @gray-500;
    margin-bottom: @spacing-xs;
  }

  &__file-error {
    .flex-start();
    gap: @spacing-xs;
    font-size: @font-size-xs;
    color: @error-600;
    align-items: center;
  }

  &__file-progress {
    .flex-start();
    gap: @spacing-sm;
    align-items: center;
    margin-top: @spacing-xs;

    span {
      font-size: @font-size-xs;
      color: @gray-600;
      min-width: 30px;
    }
  }

  &__progress-bar {
    flex: 1;
    height: 6px;
    background: @gray-200;
    border-radius: 3px;
    overflow: hidden;
  }

  &__progress-fill {
    height: 100%;
    background: @primary-600;
    border-radius: 3px;
    transition: width @transition-fast;
  }

  &__file-remove {
    width: 32px;
    height: 32px;
    .flex-center();
    border: none;
    background: transparent;
    color: @gray-400;
    border-radius: @border-radius;
    transition: all @transition-fast;
    cursor: pointer;
    flex-shrink: 0;

    &:hover {
      background: @gray-100;
      color: @gray-600;
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }
}

// Responsive
@media (max-width: 768px) {
  .file-uploader {
    &__dropzone {
      padding: @spacing-lg;
    }

    &__dropzone-content {
      gap: @spacing-md;
    }

    &__text {
      h3 {
        font-size: @font-size-base;
      }

      p {
        font-size: @font-size-sm;
      }
    }

    &__files-header {
      flex-direction: column;
      align-items: flex-start;
      gap: @spacing-xs;
    }

    &__file-item {
      padding: @spacing-sm;
    }

    &__file-preview {
      width: 50px;
      height: 35px;
    }
  }
}
